package VN.EDU.IMIC.DEVELOPER.TRANTHITHANHNGA.EXAM01.TASK1;

public class TriAngle_Controllers implements IGeometricObject  {

	private TriAngle_Entity Obj;

	public TriAngle_Controllers(TriAngle_Entity Obj) {
		this.Obj = Obj;
	}

	@Override
	public double getArea(Object iObj) {
		TriAngle_Entity Obj = (TriAngle_Entity) iObj;
		double p = (Obj.getSide1() + Obj.getSide2() + Obj.getSide3()) / 2;
		return Math.sqrt(p * (p - Obj.getSide1()) * (p - Obj.getSide2())
				* (p - Obj.getSide3()));

	}

	@Override
	public double getPerimeter(Object iObj) {
		TriAngle_Entity Obj = (TriAngle_Entity) iObj;
		return Obj.getSide1() + Obj.getSide2() + Obj.getSide3();

	}

}